package com.example.mydianping.controller;

import com.example.mydianping.dto.Result;
import com.example.mydianping.pojo.Shop;
import com.example.mydianping.service.ShopService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/shop")
public class ShopController {

    @Resource
    public ShopService shopService;

    //接收携带店铺id的请求，响应店铺信息
    @GetMapping("/{id}")
    public Result queryShopById(@PathVariable("id") Long id){
        return shopService.getById(id);
    }

    //更新店铺信息
    @PutMapping
    public Result updateShop(@RequestBody Shop shop){
        return shopService.update(shop);
    }

}
